package com.pb.infra.taskManage.controller;

import com.pb.infra.oth.entity.common.Result;
import com.pb.infra.taskManage.entity.MaJobVmCfg;
import com.pb.infra.taskManage.service.MaJobVmCfgService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 任务调度引擎 虚拟机配置表(MaJobVmCfg)表控制层
 *
 * @author 贾轶飞
 * @since 2022-10-17 15:23:53
 */
@RestController
@RequestMapping("v1/maJobVmCfg")
public class MaJobVmCfgController {
    /**
     * (MaJobVmCfg)业务层
     */
    @Resource
    private MaJobVmCfgService maJobVmCfgService;

    /**
     * ETL任务调度环境切换
     * @param maJobVmCfg 参数条件
     * @return 集合
     */
    @PostMapping("/etlMaJobTab")
    public Result etlMaJobTab(@RequestBody MaJobVmCfg maJobVmCfg) {
        return this.maJobVmCfgService.etlMaJobTab(maJobVmCfg);
    }

    /**
     * 查询
     * @param maJobVmCfg 参数条件
     * @return 集合
     */
    @PostMapping("/list")
    public Result selectAll(@RequestBody MaJobVmCfg maJobVmCfg) {
        return this.maJobVmCfgService.queryList(maJobVmCfg);
    }

    /**
     * 添加
     * @param maJobVmCfg 添加参数
     * @return 添加结果
     */
    @PostMapping("/add")
    public Result insert(@RequestBody MaJobVmCfg maJobVmCfg) {
        return this.maJobVmCfgService.insert(maJobVmCfg);
    }

    /**
     * 修改
     * @param maJobVmCfg 修改参数
     * @return 受影响条数
     */
    @PostMapping("/upd")
    public Result update(@RequestBody MaJobVmCfg maJobVmCfg) {
        return this.maJobVmCfgService.update(maJobVmCfg);
    }

    /**
     * 删除
     * @param id 唯一条件
     * @return 受影响条数
     */
    @PostMapping("/del")
    public Result delete(@RequestBody String id) {
        return this.maJobVmCfgService.delete(id);
    }
}

